/*
 * MIT License
 *
 * Copyright (c) 2023 北京凯特伟业科技有限公司
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.je.message.service.dingtalk;

import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
import com.je.message.ResultMsgResp;
import com.je.message.exception.MessageSendException;
import com.je.message.me.chanjar.dingding.common.exception.DdErrorException;
import com.je.message.vo.MessageVo;

import java.io.IOException;
import java.util.List;

/**
 * 发送文字、图片、语音等等这种接口
 */
public interface DingTalkMsgService {

    /**
     * 发送消息
     *
     * @param msgVo 消息
     * @return
     */
    ResultMsgResp send(MessageVo msgVo) ;

    /**
     * 发送文字消息
     *
     * @param userIds 用户ID
     * @param deptIds 部门ID
     * @param context 内容
     * @return
     */
    ResultMsgResp sendWz(String userIds, String deptIds, String context) throws IOException, DdErrorException, MessageSendException;

    /**
     * 发送图片消息
     *
     * @param userIds  用户ID
     * @param deptIds  部门ID
     * @param filePath 文件路径
     * @param fileName 文件名称
     * @return
     */
    ResultMsgResp sendTp(String userIds, String deptIds, String filePath, String fileName) throws IOException, DdErrorException, MessageSendException;

    /**
     * 发送语音消息
     *
     * @param userIds  用户ID
     * @param deptIds  部门ID
     * @param filePath 文件路径
     * @param fileName 文件名称
     * @return
     */
    ResultMsgResp sendYy(String userIds, String deptIds, String filePath, String fileName) throws IOException, DdErrorException, MessageSendException;

    /**
     * 发送链接消息
     *
     * @param userIds  用户ID
     * @param deptIds  部门ID
     * @param filePath 文件路径
     * @param fileName 文件名称
     * @param title    主题
     * @param text     内容
     * @param url      路径
     * @return
     */
    ResultMsgResp sendLj(String userIds, String deptIds, String filePath, String fileName, String title, String text, String url) throws IOException, DdErrorException, MessageSendException;

    /**
     * 发送OA消息
     *
     * @param userIds     用户ID
     * @param deptIds     部门ID
     * @param filePath    文件路径
     * @param fileName    文件名称
     * @param url         路径
     * @param pcUrl       TODO未处理
     * @param headText    报头内容
     * @param headColor   报头颜色
     * @param listFrom    集合From
     * @param richNum     TODO未处理
     * @param richUnit    TODO未处理
     * @param bodyContent 内容
     * @param bodyTitle   主题
     * @param fileCount   文件内容
     * @param author      TODO未处理
     * @return
     */
    ResultMsgResp sendOa(String userIds, String deptIds, String filePath, String fileName, String url, String pcUrl, String headText, String headColor,
                   List<OapiMessageCorpconversationAsyncsendV2Request.Form> listFrom, String richNum, String richUnit, String bodyContent, String bodyTitle, String fileCount, String author) throws IOException, DdErrorException, MessageSendException;


    /**
     * 发送MD消息
     *
     * @param userIds 用户ID
     * @param deptIds 部门ID
     * @param mdText  内容
     * @param title   主题
     * @return
     */
    ResultMsgResp sendMd(String userIds, String deptIds, String mdText, String title) throws IOException, DdErrorException, MessageSendException;

    /**
     * 发送卡片消息
     * @param userIds 用户ID集合 多个按逗号隔开，如果是全部人员请传@all
     */
    /**
     * 发送卡片消息
     *
     * @param userIds        用户ID
     * @param deptIds        部门ID
     * @param cardTitle      卡片主题
     * @param content        TODO未处理
     * @param btnOrientation TODO未处理
     * @param btnJsonList    TODO未处理
     * @return
     */
    ResultMsgResp sendKp(String userIds, String deptIds, String cardTitle, String content, String btnOrientation,
                   List<OapiMessageCorpconversationAsyncsendV2Request.BtnJsonList> btnJsonList) throws IOException, DdErrorException, MessageSendException;

    /**
     * 发送文件消息
     *
     * @param userIds  用户ID
     * @param deptIds  部门ID
     * @param filePath 文件路径
     * @param fileName 文件名称
     * @return
     */
    ResultMsgResp sendWj(String userIds, String deptIds, String filePath, String fileName) throws IOException, DdErrorException, MessageSendException;
}
